package com.wwwarehouse.common.custom_widget;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatRadioButton;
import android.util.AttributeSet;

import com.wwwarehouse.common.R;

/**
 * @author : mundane
 * @time : 2017/8/18 15:27
 * @description :
 * @file : UXRadioButton.java
 */

public class UXRadioButton extends AppCompatRadioButton {
	public UXRadioButton(Context context) {
		super(context);
		init();
	}

	public UXRadioButton(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	public UXRadioButton(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
		init();
	}

	private void init() {
		Drawable drawable = getResources().getDrawable(R.drawable.selector_radio);
		int right = getResources().getDimensionPixelSize(R.dimen.common_dimen_dp20);
		int padding = getResources().getDimensionPixelSize(R.dimen.common_dimen_dp10);

		drawable.setBounds(0, 0, right, right);
		setCompoundDrawables(drawable, null, null, null);
		setCompoundDrawablePadding(padding);
		setButtonDrawable(null);
	}


}
